<!doctype html><html><head><meta charset="utf-8" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="viewport" content="initial-scale=1.0, width=device-width, user-scalable=false" />
<meta name="keywords" content="" /> 
<meta name="description" content="" />
<title>LEKO&trade;</title>
<link rel="icon" type="image/ico" href="favicon.ico" />
<link rel="apple-touch-icon" href="apple-touch-icon.png" />
<link rel="stylesheet" type="text/css" href="leko.css" />
<link rel="stylesheet" type="text/css" href="leko.demo.css" />
<link rel="alternate" type="application/rss+xml" title="" href="leko.xml" />
<script src="jquery.js"></script><script src="leko.js"></script></head><body><div id="page" class="table"><header><nav></nav></header><h2 class="en">jQuery.fn.defaults</h2><hr />获取或设置相对于当前元素的指定名称LEKO插件的默认配置。这些默认配置可以在HTML源代码中用元素的行内自定义属性值指定。请参考下面的代码示例。<section><h4><b>语法</b></h4><code><i>object</i> = <strong>jQuery</strong>(<i>selector</i>).<strong>defaults</strong>(<i>plugin-name</i> , [<i>plugin-config</i>] , [<i>merge-mode</i>])</code></section><section><h4><b>参数</b></h4><table border="0" cellspacing="0" cellpadding="0"><thead><tr class="row1"><th class="col2">参数名</th><th class="col2">是否可选</th><th class="col2">缺省值</th><th class="col2">数据类型</th><th class="col2">可能的取值</th><th>说明</th></tr></thead><tbody><tr><td rowspan="1" class="en">plugin-name</td><td class="en" rowspan="1"></td><td class="en" rowspan="1"></td><td rowspan="1" class="en">string</td><td class="en"></td><td>插件名称。</td></tr><tr class="odd"><td rowspan="2" class="en">plugin-config</td><td class="en" rowspan="2">√</td><td class="en" rowspan="2">null</td><td rowspan="2" class="en">object</td><td class="en">null</td><td>获取现有配置。</td></tr><tr class="odd"><td class="en">others</td><td>用于更新配置。</td></tr><tr><td rowspan="3" class="en">merge-mode</td><td class="en" rowspan="3">√</td><td class="en" rowspan="3">0</td><td rowspan="3" class="en">number</td><td class="en">-1</td><td>将新的配置非递归地合并到现有配置。</td></tr><tr><td class="en">0</td><td>用新的配置直接完全替换掉现有配置。</td></tr><tr><td class="en">1</td><td>将新配置以递归方式合并到现有配置。</td></tr></tbody></table></section><section><h4><b>返回</b></h4><table border="0" cellspacing="0" cellpadding="0"><thead><tr class="row2"><th class="col2">数据类型</th><th class="col2">可能的取值</th><th>说明</th></tr></thead><tbody><tr><td rowspan="1" class="en">object</td><td class="en"></td><td>对获取到或修改后的配置对象的引用。如果获取失败，返回空对象。</td></tr></tbody></table></section><script>$(function(){$("button").click(function(){eval($(this).prev().prev().text());});});</script><section><h4><b>示例</b></h4><pre>var d=$(&quot;body&quot;).defaults(&quot;shadow&quot;);
console.log(d);
d.x=3;
console.log($(&quot;body&quot;).defaults(&quot;shadow&quot;,{y:6},1));
d.z=9;
console.log(d);</pre><br /><button>运行上面的代码</button><br /><br /><pre>$(&quot;body&quot;).append(&#039;&lt;div id=&quot;test&quot; shadow=&quot;color:\&#039;red\&#039;,offset:{x:3,y:3}&quot;&gt;test&lt;/div&gt;&#039;);
console.log($(&quot;#test&quot;).defaults(&quot;shadow&quot;));
</pre><br /><button>运行上面的代码</button><br /></section><section><h4><b>文件</b></h4><ol class="en"><li><a href="jquery.js">jquery.js</a> (70.48KB)</li><li class="within"><a href="leko.js">leko.js</a> (20.68KB)</li></ol></section><footer><section id="foot"><hr /><h6>苏昱(苏小雨)作品<br />灵镭信息科技，创造代码之美</h6><a class="en" href="http://www.lekolite.cn" target="_blank">Copyright © 2010 lekolite.cn , All rights reserved</a></section></footer></div></body></html>